home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD World 1998 January
/
CD World - Ocak 1998.iso
/
misc
/
dbase55
/
disk6
/
samples1.pak
/
LINEITEM.MNU
< prev
next >
Wrap
Text File
|
1996-01-05
|
7KB
|
198 lines
******************************************************************************
* PROGRAM: Lineitem.mnu
*
* WRITTEN BY: Borland Samples Group
*
* DATE: 12/93
*
* UPDATED: 6/95
*
* REVISION: $Revision: 1.12 $
*
* VERSION: Visual dBASE
*
* DESCRIPTION: This is a menu file used by Custord.wfm for
* performing line item tasks. It allows adding and deleting
* records, searching for a value in the stock_no field of the
* current table viewed, and exiting the form in view.
*
* PARAMETERS: FormObj -- the form to which this menu will belong.
*
* CALLS: None
*
* USAGE: form.menuFile = "Lineitem.mnu"
*
*******************************************************************************
#include <Messdlg.h>
** END HEADER -- do not remove this line*
* Generated on 05/06/94
*
Parameter FormObj
NEW LINEITEMMENU(FormObj,"Root")
CLASS LINEITEMMENU(FormObj,Name) OF MENUBAR(FormObj,Name)
this.Text = ""
this.OnInit = {;set procedure to &_dbwinhome.samples\Sampproc.prg}
DEFINE MENU FILE OF THIS;
PROPERTY;
Text "&File"
DEFINE MENU EXIT OF THIS.FILE;
PROPERTY;
OnClick CLASS::EXIT_ONCLICK,;
Text "E&xit",;
StatusMessage "Leave form."
DEFINE MENU LINEITEM OF THIS;
PROPERTY;
Text "&Lineitem"
DEFINE MENU VIEWEDIT OF THIS.LINEITEM;
PROPERTY;
OnClick CLASS::VIEWEDITONCLICK,;
Text "&Edit",;
Shortcut "Ctrl-E",;
StatusMessage "Edit data."
DEFINE MENU SEPARATOR1 OF THIS.LINEITEM;
PROPERTY;
Separator .T.,;
Text ""
DEFINE MENU ADD OF THIS.LINEITEM;
PROPERTY;
OnClick CLASS::ADDONCLICK,;
Text "&Add",;
Enabled .T.,;
Shortcut "Ctrl-A",;
StatusMessage "Add a new line item."
DEFINE MENU DELETE OF THIS.LINEITEM;
PROPERTY;
OnClick CLASS::DELETEONCLICK,;
Text "&Delete",;
Enabled .F.,;
Shortcut "Ctrl-D",;
StatusMessage "Delete the current line item."
DEFINE MENU SEPARATOR2 OF THIS.LINEITEM;
PROPERTY;
Separator .T.,;
Text ""
DEFINE MENU SEARCH OF THIS.LINEITEM;
PROPERTY;
OnClick CLASS::SEARCHONCLICK,;
Text "&Search ...",;
Shortcut "Ctrl-S",;
StatusMessage "Search for a line item."
****************************************************************************
procedure SearchOnClick
* Bring up Search.wfm.
****************************************************************************
private searchForm, searchItem, saveRec, saveFilt, keyFieldName
if reccount() = 0 && If table is empty, don't search
InformationMessage("This table is empty.", "Oops")
else
form.CheckChanged(.t.)
set procedure to &_dbwinhome.samples\Search.wfm additive
searchForm = new SearchForm()
searchForm.keyName = "Stock Number" && Indicator of key expression
searchForm.formatting = "99999" && format specific to this key
searchForm.mdi = .F.
searchItem = searchForm.Readmodal()
if type("searchItem") = "O" .and. searchItem.id <> 0
&& If search wasn't cancelled
saveRec = recno() && save current record in case seek is unsucessfull
keyFieldName = "Stock_no"
* Change value to '0' padded string of length 5
locate for &keyFieldName = searchForm.value
if .not. found()
InformationMessage(FormatStr("Stock Number %1 \n Was not Found.",;
searchForm.value),;
"Info")
if saveRec <= reccount() && If weren't at eof(), go to saveRec
go saveRec
else
go bottom
endif
endif
endif
searchForm.Release()
close procedure &_dbwinhome.samples\Search.wfm
endif
****************************************************************************
procedure DeleteOnClick
* Delete current record.
****************************************************************************
if ConfirmationMessage("Are you sure you want to delete this line item?",;
"Confirm") = YES
delete && DELETED is ON, so deleted records are still there until
&& a PACK is executed
commit()
form.curPage.changesMade = .F.
begintrans()
*form.custOrdNextButton.OnClick() && Move to next record
endif
****************************************************************************
procedure AddOnClick
* Add new record.
****************************************************************************
private addForm, curStockNo, stockNoField, newStockNo
form.CheckChanged(.t.)
if ConfirmationMessage("Are you sure you want to add a line item?",;
"Confirmation") = YES
if .not. form.curPage.inEditMode
form.ViewEdit() && Make sure record is editable
endif
form.curPage.changesMade = .T.
form.previousRecord = recno()
stockNoField = field(2) && Stock_no field
curStockNo = &stockNoField && Current order number
newStockNo = str(val(form.maxStockNo) + 1, 5)
append blank
* replace &orderNoField with curOrderNo && Integrity takes care of this
replace &stockNoField with newStockNo
form.maxStockNo = newStockNo
refresh
endif
***************************************************************************
procedure ViewEditOnClick
* Toggle between View and Edit modes.
****************************************************************************
form.ViewEdit()
****************************************************************************
procedure Exit_OnClick
****************************************************************************
form.Close()
ENDCLASS